package com.ncloud.aaaa.repository;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import com.ncloud.aaaa.model.Subsys;

public interface SubsysRepository extends CrudRepository<Subsys, Long> {
	Page<Subsys> findAll(Pageable pageable);

	@Query("select distinct c from UserRole a,RoleSubsys b,Subsys c where "
			+ " a.id.userId = ?1 and a.id.roleId = b.roleId and b.subsysId = c.id and c.state = '1' order by c.sort")
	List<Subsys> getSubsysListByUserId(Long userId);
}
